package com.enjoyread.common.utils;

import com.enjoyread.common.config.SystemConfig;

import java.util.UUID;

public class FileUtils {
    /**
     * 对文件名长度进行限制及添加随机字符串，防止名字重复*/
    public static String rename(String f){
        if(f.length()> SystemConfig.FILE_NAME_LENGTH){
            f=f.substring(f.length()-SystemConfig.FILE_NAME_LENGTH);
        }
        return UUID.randomUUID().toString().replaceAll("-","")+"_"+f;
    }
}
